package com.ruoyi.web.controller.newTable;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.TSs;
import com.ruoyi.system.service.ITSsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 硕士招生选拔和授予学位情况Controller
 * 
 * @author ruoyi
 * @date 2024-12-07
 */
@RestController
@RequestMapping("/system/ss")
public class TSsController extends BaseController
{
    @Autowired
    private ITSsService tSsService;

    /**
     * 查询硕士招生选拔和授予学位情况列表
     */
    @PreAuthorize("@ss.hasPermi('system:ss:list')")
    @GetMapping("/list")
    public TableDataInfo list(TSs tSs)
    {
        startPage();
        List<TSs> list = tSsService.selectTSsList(tSs);
        return getDataTable(list);
    }

    /**
     * 导出硕士招生选拔和授予学位情况列表
     */
    @PreAuthorize("@ss.hasPermi('system:ss:export')")
    @Log(title = "硕士招生选拔和授予学位情况", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TSs tSs)
    {
        List<TSs> list = tSsService.selectTSsList(tSs);
        ExcelUtil<TSs> util = new ExcelUtil<TSs>(TSs.class);
        util.exportExcel(response, list, "硕士招生选拔和授予学位情况数据");
    }

    /**
     * 获取硕士招生选拔和授予学位情况详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:ss:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tSsService.selectTSsById(id));
    }

    /**
     * 新增硕士招生选拔和授予学位情况
     */
    @PreAuthorize("@ss.hasPermi('system:ss:add')")
    @Log(title = "硕士招生选拔和授予学位情况", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TSs tSs)
    {
        return toAjax(tSsService.insertTSs(tSs));
    }

    /**
     * 修改硕士招生选拔和授予学位情况
     */
    @PreAuthorize("@ss.hasPermi('system:ss:edit')")
    @Log(title = "硕士招生选拔和授予学位情况", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TSs tSs)
    {
        return toAjax(tSsService.updateTSs(tSs));
    }

    /**
     * 删除硕士招生选拔和授予学位情况
     */
    @PreAuthorize("@ss.hasPermi('system:ss:remove')")
    @Log(title = "硕士招生选拔和授予学位情况", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tSsService.deleteTSsByIds(ids));
    }
}
